Bifurcate list based on values
Splits values into two groups, based on the result of the given filter
list.
The Python snippet collection contains helper functions for Python 3.6. It includes utilities for most common data types, such as primitivies, lists, dictionaries and date objects.
Splits values into two groups, based on the result of the given filter
list.
Converts a number to a list of digits.
Finds the indexes of all elements in the given list that satisfy the provided testing function.
Finds the index of the first element in the given list that satisfies the provided testing function.
Finds the index of the last element in the given list that satisfies the provided testing function.
Retrieves the value of the nested key indicated by the given selector list from a dictionary or list.
Learn how Python's lists and tuples are different and level up your code today.
Maps the values of a list to a dictionary using a function.
Mutable default arguments can trip up Python beginners and veterans alike. Here's a quick workaround to deal with them.
Understand Python's named tuples and start using them in your projects today.
Chunks a list into n
smaller lists.
Finds the value of the last element in the given list that satisfies the provided testing function.
Finds the items that are parity outliers in a given list.
Finds the value of the first element in the given list that satisfies the provided testing function.
Learn two ways to format a string in Python with this quick tip.
Checks if the a value is an empty sequence or collection.
Converts a list of dictionaries into a list of values corresponding to the specified key
.
Converts the values of RGB components to a hexadecimal color code.
Using str.lstrip()
to strip a prefix from a string might not be exactly what you're looking for. Here's what you should use instead.
Returns the sum of the powers of all the numbers from start
to end
(both inclusive).
Chunks a list into smaller lists of a specified size.
Inverts a dictionary with unique hashable values.
Merges two or more dictionaries.
Learn how to sort a Python dictionary list using a tuple key.